package EXP1_Nvwa;

/**
 * @author Liweijian.
 * @Description TODO
 * @date 2025/3/18 14:50
 */
// 简单工厂类
public class Factory {
    public static Person createPerson(String type) {
        switch (type) {
            case "M":
                return new Man();
            case "W":
                return new Woman();
            case "R":
                return new Robot();
            default:
                throw new IllegalArgumentException("不支持的类型: " + type);
        }
    }
}
